package com.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.api.common.jwt.TokenIgnore;
import com.api.common.reqres.Request;
import com.api.common.reqres.Response;
import com.api.model.request.NullRequest;
import com.api.model.request.ShippingAddressInsertRequest;
import com.api.model.request.ShippingAddressUpdateRequest;
import com.api.model.response.NullResponse;
import com.api.model.response.ShippingAddressListResponse;
import com.api.service.ShippingAddressService;

import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 收货地址
 * </p>
 *
 * @author cfp
 * @since 2019-10-14
 */
@TokenIgnore
@RestController
public class ShippingAddressController {
	@Autowired
	private ShippingAddressService shippingAddressService;

	@ApiOperation(notes = "查询收货地址", value = "查询收货地址")
	@PostMapping(value = "/shippingAddressList.do")
	public Response<NullResponse> shippingAddressList(@RequestBody Request<NullRequest> request) throws Exception {
		return shippingAddressService.shippingAddressList(request);
	}

	@ApiOperation(notes = "修改收货地址", value = "修改收货地址")
	@PostMapping(value = "/shippingAddressUpdate.do")
	public Response<NullResponse> shippingAddressUpdate(@RequestBody Request<ShippingAddressUpdateRequest> request)
			throws Exception {
		return shippingAddressService.shippingAddressUpdate(request);
	}

	@ApiOperation(notes = "添加收货地址", value = "添加收货地址")
	@PostMapping(value = "/shippingAddressInsert.do")
	public Response<NullResponse> shippingAddressInsert(@RequestBody Request<ShippingAddressInsertRequest> request)
			throws Exception {
		return shippingAddressService.shippingAddressInsert(request);
	}
}
